import React from 'react'
import { useHistory } from 'react-router-dom'
import { PageParam } from './type'

export default function Login () {
  // 补充一个泛型，约定传递的参数的格式
  const history = useHistory<PageParam>()
  const click = () => {
    // history.push('/home', { a: 1 })
    history.push({ pathname: '/home', state: { a: 100 } })
  }
  return (
    <>
      <button onClick={click}>跳到home，带参数</button>
      <div>Login</div>
    </>
  )
}
